/**
 * @todo 安装了路由 yarn add vue-router
 * @todo 创建路由实例配置路由规则
 * @todo 导出
 * @todo 在main.ts中挂载
 * @todo app.vue文件中准备路由出口
 */

import { createRouter, createWebHashHistory } from 'vue-router'

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    { path: '/login', component: () => import('@/views/login/index.vue') },
    {
      path: '/',
      component: () => import('@/views/layout/index.vue'),
      children: [
        { path: '/', component: () => import('@/views/home/index.vue') },
        { path: '/text', component: () => import('@/views/text/index.vue') },
        { path: '/category/:id', component: () => import('@/views/category/index.vue') },
        { path: '/category/sub/:id', component: () => import('@/views/category/sub.vue') }
      ]
    } // 懒加载
  ]
})

export default router
